<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script language="JavaScript">
        var reg = /\w/gim ;        // m表示多行匹配
        var str = "a>b_c|d\nf?g";
        //var str = ">a|\n?";
        str = str.replace(reg,"A");
        console.log(str);
        /*
        var flag = reg.test(str);
        console.log(flag);
        */
    </script>
</head>
<body>

</body>
</html>